﻿Imports Microsoft.DirectX
Imports Microsoft.DirectX.Direct3D
Public Class LandschaftstexturBerg
    Inherits ObjektLandschaftsTextur

    'Dim TexturLandschaft As Texture
    Dim Mesh As Objekt3D
    Public Sub New()
        ID = "BERG"
        Landschaftsname = "Berg"
        Deckung = 4
        Tarnung = False
        KP = -1

        Ausrichtungslandschaften = New String() {}
        Gross = True

        If DataSettings.draw3D Then
            Ini3D()
        End If
        TexturenLaden(New String() {"Berg", "Berg+1"})
        Normal = 1
    End Sub

    Public Overrides Sub Malen3D(ByVal p_MatCube As Microsoft.DirectX.Matrix, ByVal Landschaft As ObjektLandschaft)
        ' Grafikengine.Grafikkarte.SetTexture(0, TexturLandschaft)
        Dim standardMatrix As Matrix = Grafikengine.Grafikkarte.Transform.World
        Grafikengine.Grafikkarte.Transform.World = p_MatCube

        'Grafikengine.Grafikkarte.VertexFormat = Microsoft.DirectX.Direct3D.CustomVertex.PositionTextured.Format

        'Berechnen:
        'Dim cube(3) As CustomVertex.PositionTextured
        'cube(0) = New CustomVertex.PositionTextured(0, 0, 0, 0, 1)
        'cube(1) = New CustomVertex.PositionTextured(0, 0, 1, 0, 0)
        'cube(2) = New CustomVertex.PositionTextured(1, 0, 0, 1, 1)
        'cube(3) = New CustomVertex.PositionTextured(1, 0, 1, 1, 0)


        'Anzeigen:
        'Grafikengine.Grafikkarte.VertexFormat = CustomVertex.PositionTextured.Format

        '  Grafikengine.Grafikkarte.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, cube)
        Objekt3D.SpielerFarbe = ObjektmarkiertesFeld.getFeldFarbe(Landschaft.KooX, Landschaft.KooY)
        Mesh.Malen(p_MatCube, True)
        'ObjektLadeklasse.Gebaeude3D.Malen("HQ", p_MatCube.M41, p_MatCube.M43)
        'Wieder den Ursprungsstatus wiederherstellen..
        Grafikengine.Grafikkarte.Transform.World = standardMatrix
    End Sub

    Public Overrides Sub Ini3D()
        ' TexturLandschaft = Grafikengine.LoadTexture(DataSettings.Resourcenpfad + "Terrain\Overworld\3D\" + DataSettings.TexturQuali + "\Berg.bmp")
        Mesh = New Objekt3D
        Mesh.MeshBildLaden(DataSettings.Resourcenpfad + "Terrain\Meshes\Berg.X")
    End Sub

    Public Overrides Sub Tick()

    End Sub
    Public Overrides Function getFigurPos(ByVal Pos As ObjektLandschaftsTextur.Positionsarten) As Microsoft.DirectX.Vector3
        Select Case Pos
            Case Positionsarten.Luft
                Return New Vector3(0.5, 1.3, 0.5)
            Case Positionsarten.Boden
                Return New Vector3(0.5, 0.905, 0.5)
            Case Else
                Return MyBase.getFigurPos(Pos)
        End Select
    End Function

    Public Overrides Function getMesh() As Microsoft.DirectX.Direct3D.Mesh
        Return Mesh.MeshBild.moMesh
    End Function
    Public Overrides Function GetTerrainUntergrund() As String()
        Return New String() {"EBENE", "WUESTE", "SCHNEE"}
    End Function
    Public Overrides Function DrawSpecialStyle(ByVal BildID As Integer, ByVal Fog As Nebelarten, ByVal Alpha As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal TerrainUntergrundID As Integer, ByVal TerrainUntergrundBildID As Integer, ByVal TerrainUntergrundID2 As Integer, ByVal TerrainUntergrundBildID2 As Integer, Optional ByVal FixedLocation As Boolean = False, Optional ByVal Top As Boolean = False) As Boolean
        Return DrawTerrainUndUntergrund(Alpha, Fog, BildID, X, Y, 0, 0, TerrainUntergrundID, TerrainUntergrundBildID, TerrainUntergrundID2, TerrainUntergrundBildID2, FixedLocation, Top)
    End Function
End Class
Public Class LandschaftstexturGipfel
    Inherits ObjektLandschaftsTextur



    Public Sub New()
        ID = "GIPFEL"
        Landschaftsname = "Berggipfel"
        Deckung = 4
        Tarnung = False
        KP = -1
        Gross = True
        TexturenLaden(New String() {"Berggipfel", "Berggipfel+1"})
        Normal = 1
        Ausrichtungslandschaften = New String() {}
    End Sub

    Public Overrides Function GetTerrainUntergrund() As String()
        Return New String() {"SCHNEE", "EBENE", "WUESTE"}
    End Function
    Public Overrides Function DrawSpecialStyle(ByVal BildID As Integer, ByVal Fog As Nebelarten, ByVal Alpha As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal TerrainUntergrundID As Integer, ByVal TerrainUntergrundBildID As Integer, ByVal TerrainUntergrundID2 As Integer, ByVal TerrainUntergrundBildID2 As Integer, Optional ByVal FixedLocation As Boolean = False, Optional ByVal Top As Boolean = False) As Boolean
        Return DrawTerrainUndUntergrund(Alpha, Fog, BildID, X, Y, 0, 0, TerrainUntergrundID, TerrainUntergrundBildID, TerrainUntergrundID2, TerrainUntergrundBildID2, FixedLocation, Top)
    End Function

    Public Overrides Sub Malen3D(ByVal p_MatCube As Microsoft.DirectX.Matrix, ByVal Landschaft As ObjektLandschaft)

    End Sub

    Public Overrides Sub Ini3D()

    End Sub

    Public Overrides Sub Tick()

    End Sub
End Class
Public Class LandschaftstexturFelsen
    Inherits ObjektLandschaftsTextur



    Public Sub New()
        ID = "FELSEN"
        Landschaftsname = "Felsen"
        Deckung = 3
        Tarnung = False
        KP = -1
        Select Case DataSettings.TerrainStyle
            Case TerrainStyle.CommanderWars2, TerrainStyle.AdvanceWarsDC
                Gross = True
            Case Else
                Gross = False
        End Select
        TexturenLaden(New String() {"Felsen"})
        Normal = 0
        Ausrichtungslandschaften = New String() {}
    End Sub

    Public Overrides Function GetTerrainUntergrund() As String()
        Return New String() {"WUESTE", "SCHNEE", "EBENE"}
    End Function
    Public Overrides Function DrawSpecialStyle(ByVal BildID As Integer, ByVal Fog As Nebelarten, ByVal Alpha As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal TerrainUntergrundID As Integer, ByVal TerrainUntergrundBildID As Integer, ByVal TerrainUntergrundID2 As Integer, ByVal TerrainUntergrundBildID2 As Integer, Optional ByVal FixedLocation As Boolean = False, Optional ByVal Top As Boolean = False) As Boolean
        Return DrawTerrainUndUntergrund(Alpha, Fog, BildID, X, Y, 0, 0, TerrainUntergrundID, TerrainUntergrundBildID, TerrainUntergrundID2, TerrainUntergrundBildID2, FixedLocation, Top)
    End Function
    Public Overrides Sub Malen3D(ByVal p_MatCube As Microsoft.DirectX.Matrix, ByVal Landschaft As ObjektLandschaft)

    End Sub

    Public Overrides Sub Ini3D()

    End Sub

    Public Overrides Sub Tick()

    End Sub
End Class
